/*
 * @Description: 
 * @Autor: 赵子惠
 * @Date: 2021-09-07 13:43:32
 * @LastEditors: 商晓彬
 * @LastEditTime: 2022-02-21 15:13:04
 */
import { AfterViewChecked, Component, ElementRef, EventEmitter, Injector, Input, Output, ViewChild } from '@angular/core';
import { AppComponentBase } from '@shared/common/app-component-base';
import { ModalDirective } from 'ngx-bootstrap';
import * as _ from 'lodash';
import { finalize } from 'rxjs/operators';
import { MessageService } from '@abp/message/message.service';
import { OperationHistoryServiceProxy, CollectBomServiceProxy } from '@shared/service-proxies/service-proxies';

@Component({
    selector: 'app-bom-look',
    templateUrl: './bom-look.component.html',
    styleUrls: ['./bom-look.component.less']
})
export class BomLookComponent extends AppComponentBase {

    //引入子组件
    @ViewChild('createOrEditModal') modal: ModalDirective;
    @Input() parentInfo: any;
    tableData = []
    active = false;

    constructor(
        injector: Injector,
        private _messageService: MessageService,
        private _operationHistoryServiceProxy: OperationHistoryServiceProxy,
        private _collectBomServiceProxy: CollectBomServiceProxy,
    ) {
        super(injector);
    }

    ngOnInit() {
    }
    getTableList() {
        if (this.parentInfo && this.parentInfo.xjId) {
            abp.ui.setBusy();
            this._collectBomServiceProxy.getCollectBomMaterialsContent(this.parentInfo.xjId)
                .pipe(finalize(() => { }))
                .subscribe(result => {
                    abp.ui.clearBusy();
                    this.tableData = result
                })
        }
    }
    //查看新增任务
    show(): void {
        this.active = true;
        this.modal.show();
    }
    //关闭事件
    close(): void {
        this.active = false;
        this.tableData = [];
        this.modal.hide();
    }
    onShown(): void {

    }
}
